home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d897.lha / EPP / PModules / cSkipWhite.e < prev    next >
Text File  |  1993-06-26  |  1KB  |  34 lines

  1. OPT TURBO
  2.  
  3. PROC cSkipWhite (pos : PTR TO CHAR)
  4.   DEF c
  5.  
  6.   /*----------------------------------------------------------------------*/
  7.   /* pos must point into a null-terminated string!                        */
  8.   /* pos must be passed by value!                                         */
  9.   /* pos must not point beyond the end of the string when it's passed in! */
  10.   /*                                                                      */
  11.   /* Skips SPACE, TAB, LF, CR.  Returns end pos so that the following     */
  12.   /* statement sequence can be used in the calling program:               */
  13.   /*   length := (cSkipWhite (startPos) - startPos)                       */
  14.   /*   MidStr (someString, startPos, 0, length)                           */
  15.   /*                                                                      */
  16.   /* If you use the string with index method in your main program, you    */
  17.   /* can get the PTR TO CHAR pos by using:                                */
  18.   /*   length := (cSkipWhite (string + index) - (string + index))         */
  19.   /*   MidStr (someString, string, index, length)                         */
  20.   /*----------------------------------------------------------------------*/
  21.  
  22.   WHILE (c := pos [])
  23.     SELECT c
  24.       CASE 32; INC pos  /* SPACE */
  25.       CASE  9; INC pos  /* TAB */
  26.       CASE 10; INC pos  /* LF */
  27.       DEFAULT; RETURN pos
  28.     ENDSELECT
  29.   ENDWHILE
  30.  
  31. ENDPROC  pos
  32.   /* cSkipWhite */
  33.  
  34.